import fetch from '../utils/fetch'
import config from '../utils/config'
import { querystring } from 'vux'

var SuggestService = {
  getMySuggest (providerGUID) {
    var data = {
      action: 'GetMySuggest',
      ProviderGUID: providerGUID
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  getMySuggestDetail (mySuggestGUID) {
    var data = {
      action: 'GetMySuggestDetail',
      MySuggestGUID: mySuggestGUID
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  getSuggestType () {
    var data = {
      action: 'GetSuggestType'
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  getBU () {
    var data = {
      action: 'GetBU'
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  submittMySuggest: function (suggestData) {
    suggestData.action = 'SubmittMySuggest'// 提交我的投诉
    suggestData.handleType = 'submit&add'
    var url = config.API_SERVER + '/WXApi.ajax'
    return fetch({
      url: url,
      method: 'POST',
      data: querystring.stringify(suggestData),
      headers: {'Content-Type': 'application/x-www-form-urlencoded'}
    })
  }
}

export default SuggestService
